package com.hovhanna.monopoly.model;

public class Player extends Model<Player.PlayerUpdateEnum> {
    private final String name;
    private final Token token;
    private int cash;

    public Player(String name, int initialCache, Token token) {
        this.name = name;
        this.cash = initialCache;
        this.token = token;
    }
    
    public String getName() {
        return name;
    }
    
    public Token getToken() {
        return token;
    }
    
    public int getCash() {
        return cash;
    }

    public void payRent(int cash) {
        if (cash != 0) {
            this.cash -= cash;
            publish(PlayerUpdateEnum.CASH);
        }
    }
    
    public static enum PlayerUpdateEnum {
        NAME,
        CASH;
    }
}
